<template>
  <div class="probox">
    <div class="pro-t">User price</div>
    <div class="itembox">
      <div v-for="(i, index) in userdatas" :key="index" class="item">
        <div class="l">
          <div class="img">
            <img :src="'http://127.0.0.1:3006' + i.img" alt="" />
          </div>
          <div class="l-r">
            <div>{{ i.name }}</div>
            <div>
              {{ i.phone }}
            </div>
          </div>
        </div>
        <div class="r">
          <div>￥{{ i.price }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { getuserandpriss } from "@/api/index";
const userdatas = ref([]);
onMounted(async () => {
  const ruadta = await getuserandpriss();
  if (ruadta.code == 200) {
    userdatas.value = ruadta.data;
  }
});
// const userdata = [
//   {
//     img: "src/assets/img/qqdzz.png",
//     name: "ximo",
//     address: ["河南", "信阳"],
//     pri: 321,
//   },
//   {
//     img: "src/assets/img/qqdzz.png",
//     name: "ximo",
//     address: ["河南", "信阳"],
//     pri: 321,
//   },
//   {
//     img: "src/assets/img/qqdzz.png",
//     name: "ximo",
//     address: ["河南", "信阳"],
//     pri: 321,
//   },
//   {
//     img: "src/assets/img/qqdzz.png",
//     name: "ximo",
//     address: ["河南", "信阳"],
//     pri: 321,
//   },
// ];
</script>

<style scoped lang="scss">
.probox {
  height: 100%;
  width: 100%;
  padding: 15px 20px;
  .pro-t {
    font-size: 0.7vw;
    font-weight: 700;
    color: #a6a8ac;
    align-items: center;
  }
  .itembox {
    width: 100%;
    height: calc(100% - 20px);
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    overflow: auto;
  }
  .item {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--them-color2);
    font-size: 0.7vw;
    font-weight: 700;
    .l {
      display: flex;
      align-items: center;
      gap: 8px;
      .img {
        width: 1.7vw;
        height: 1.7vw;
        border-radius: 50%;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.3s;
        &:hover {
          box-shadow: 0 0 10px 5px rgba($color: #fff, $alpha: 0.5);
        }
        &:hover img {
          transform: scale(1.05);
        }
        img {
          height: 1.7vw;
          width: 1.7vw;
        }
      }
      .l-r {
        display: flex;
        flex-direction: column;
        gap: 5px;
        color: #fff;
      }
    }
    .r {
      height: 40%;
      width: 50px;
      background-color: var(--them-color);
      border-radius: 5px;
      color: #000;
      display: flex;
      align-items: center;
      font-size: 0.6vw;
      &:hover {
        box-shadow: 0 0 10px 5px rgba($color: #fff, $alpha: 0.5);
        transition: all 0.3s;
        cursor: pointer;
      }
      > div {
        padding: 5px;
        width: 100%;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}
</style>
